package org.project.choujiang.pojo.ro;

import lombok.Data;

@Data
public class R<T> {
    private String msg;
    private T data;
    private Integer code;


    public static <T> R<T> success(T data){
        R<T> objectR = new R<>();
        objectR.setData(data);
        objectR.setCode(200);
        return objectR;
    }

    public static R fail(String data){
        R<String> objectR = new R<>();
        objectR.setCode(0);
        objectR.setMsg(data);
        return objectR;
    }

    public static R redl(String data){
        R<String> objectR = new R<>();
        objectR.setCode(401);
        objectR.setMsg(data);
        return objectR;
    }
}
